/* eslint-disable*/
import React from 'react';
import { Tooltip } from 'antd';

import './index.less';

export default (props: any) => {
  const { text = '', contentText = '', lengthNum = 15, style = {} } = props;
  const textLength = text.length;
  let str;
  if (textLength <= lengthNum) {
    str = text;
  } else {
    str = text.slice(0, lengthNum - 3) + '...';
  }
  return (
    <Tooltip overlayClassName="X-toolTip" title={text}>
      <span className={'X-toolTip-content'} style={style}>
        {contentText ? contentText : str}
      </span>
    </Tooltip>
  );
};